﻿//+------------------------------------------------------------------+
//|                                             MetaTrader 5 Web API |
//|                   Copyright 2001-2015, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
using System;
using System.Collections.Generic;
//---
namespace MetaQuotes.MT5WebAPI.Common
  {
  /// <summary>
  /// Symbol trade and quotes sessions config  
  /// </summary>
  public class MTConSymbolSession
    {
    /// <summary>
    /// session start in minutes (60 = 01:00)
    /// </summary>
    public uint Open { get; set; }
    /// <summary>
    /// session start hours and minutes
    /// </summary>
    public uint OpenHours { get; set; }
    /// <summary>
    /// session end in minutes (60 = 01:00)
    /// </summary>
    public uint Close { get; set; }
    /// <summary>
    /// session end hours and minutes
    /// </summary>
    public uint CloseHours { get; set; }
    };
  /// <summary>
  /// Symbols configuration for clients group
  /// </summary>
  public class MTConSymbol
    {
    /// <summary>
    /// allowed filling modes flags
    /// </summary>
    public enum EnFillingFlags :uint
      {
      FILL_FLAGS_NONE = 0, // none
      FILL_FLAGS_FOK  = 1, // allowed FOK
      FILL_FLAGS_IOC  = 2, // allowed IOC
      //--- flags borders
      FILL_FLAGS_FIRST = FILL_FLAGS_FOK,
      FILL_FLAGS_ALL = FILL_FLAGS_FOK | FILL_FLAGS_IOC
      };
    /// <summary>
    /// allowed order expiration modes flags
    /// </summary>
    public enum EnExpirationFlags :uint
      {
      TIME_FLAGS_NONE          = 0, // none
      TIME_FLAGS_GTC           = 1, // allowed Good Till Cancel
      TIME_FLAGS_DAY           = 2, // allowed Good Till Day
      TIME_FLAGS_SPECIFIED     = 4, // allowed specified expiration date
      TIME_FLAGS_SPECIFIED_DAY = 8, // allowed specified expiration date as day
      //--- flags borders
      TIME_FLAGS_FIRST = TIME_FLAGS_GTC,
      TIME_FLAGS_ALL   = TIME_FLAGS_GTC | TIME_FLAGS_DAY | TIME_FLAGS_SPECIFIED | TIME_FLAGS_SPECIFIED_DAY
      };
    /// <summary>
    /// allowed trade modes
    /// </summary>
    public enum EnTradeMode :uint
      {
      TRADE_DISABLED  = 0, // trade disabled
      TRADE_LONGONLY  = 1, // only long positions allowed
      TRADE_SHORTONLY = 2, // only short positions allowed
      TRADE_CLOSEONLY = 3, // only positions closure
      TRADE_FULL      = 4, // all trade operations are allowed
      //--- public enum eration borders
      TRADE_FIRST = TRADE_DISABLED,
      TRADE_LAST  = TRADE_FULL
      }
    /// <summary>
    /// order execution modes
    /// </summary>
    public enum EnExecutionMode :uint
      {
      EXECUTION_REQUEST  = 0, // Request Execution
      EXECUTION_INSTANT  = 1, // Instant Execution
      EXECUTION_MARKET   = 2, // Market Execution
      EXECUTION_EXCHANGE = 3, // Exchange Execution
      //--- public enum eration borders
      EXECUTION_FIRST = EXECUTION_REQUEST,
      EXECUTION_LAST = EXECUTION_EXCHANGE
      }
    /// <summary>
    /// profit and margin calculation modes
    /// </summary>
    public enum EnCalcMode :uint
      {
      //--- market maker modes
      TRADE_MODE_FOREX       = 0,
      TRADE_MODE_FUTURES     = 1,
      TRADE_MODE_CFD         = 2,
      TRADE_MODE_CFDINDEX    = 3,
      TRADE_MODE_CFDLEVERAGE = 4,
      //--- market makers public enum erations
      TRADE_MODE_MM_FIRST = TRADE_MODE_FOREX,
      TRADE_MODE_MM_LAST = TRADE_MODE_CFDLEVERAGE,
      //--- exchange modes
      TRADE_MODE_EXCH_STOCKS        = 32,
      TRADE_MODE_EXCH_FUTURES       = 33,
      TRADE_MODE_EXCH_FUTURES_FORTS = 34,
      TRADE_MODE_EXCH_OPTIONS       = 35,
      TRADE_MODE_EXCH_OPTIONS_MARGIN= 36,
      TRADE_MODE_EXCH_BONDS         = 37,
      //--- exchange public enum erations
      TRADE_MODE_EXCH_FIRST = TRADE_MODE_EXCH_STOCKS,
      TRADE_MODE_EXCH_LAST  = TRADE_MODE_EXCH_BONDS,
      //--- service modes
      TRADE_MODE_SERV_COLLATERAL    =64,
      //--- service enumerations
      TRADE_MODE_SERV_FIRST         =TRADE_MODE_SERV_COLLATERAL,
      TRADE_MODE_SERV_LAST          =TRADE_MODE_SERV_COLLATERAL,
      //--- public enum eration borders
      TRADE_MODE_FIRST = TRADE_MODE_FOREX,
      TRADE_MODE_LAST = TRADE_MODE_EXCH_FUTURES_FORTS
      };
    /// <summary>
    /// orders expiration modes
    /// </summary>
    public enum EnGTCMode :uint
      {
      ORDERS_GTC            = 0,
      ORDERS_DAILY          = 1,
      ORDERS_DAILY_NO_STOPS = 2,
      //--- public enum eration borders
      ORDERS_FIRST = ORDERS_GTC,
      ORDERS_LAST  = ORDERS_DAILY_NO_STOPS
      };
    /// <summary>
    /// tick collection flags
    /// </summary>
    public enum EnTickFlags :uint
      {
      TICK_REALTIME   = 1,  // allow realtime tick apply
      TICK_COLLECTRAW = 2,  // allow to collect raw ticks
      TICK_FEED_STATS = 4,  // allow to receive price statisticks from datafeeds
      //--- flags borders
      TICK_NONE = 0,
      TICK_ALL  = TICK_REALTIME | TICK_COLLECTRAW | TICK_FEED_STATS
      };
    /// <summary>
    /// margin check modes
    /// </summary>
    public enum EnMarginFlags :uint
      {
      MARGIN_FLAGS_NONE            = 0,  // none
      MARGIN_FLAGS_CHECK_PROCESS   = 1,  // check margin after dealer confirmation
      MARGIN_FLAGS_CHECK_SLTP      = 2,  // check margin on SL-TP trigger
      MARGIN_FLAGS_HEDGE_LARGE_LEG = 4,  // check margin for hedged positions using large leg
      //--- public enum eration borders
      MARGIN_FLAGS_FIRST = MARGIN_FLAGS_NONE,
      MARGIN_FLAGS_LAST  = MARGIN_FLAGS_HEDGE_LARGE_LEG
      };
    /// <summary>
    /// swaps calculation modes
    /// </summary>
    public enum EnSwapMode :uint
      {
      SWAP_DISABLED = 0,
      SWAP_BY_POINTS = 1,
      SWAP_BY_SYMBOL_CURRENCY = 2,
      SWAP_BY_MARGIN_CURRENCY = 3,
      SWAP_BY_GROUP_CURRENCY = 4,
      SWAP_BY_INTEREST_CURRENT = 5,
      SWAP_BY_INTEREST_OPEN = 6,
      SWAP_REOPEN_BY_CLOSE_PRICE = 7,
      SWAP_REOPEN_BY_BID = 8,
      //--- public enum eration borders
      SWAP_FIRST = SWAP_DISABLED,
      SWAP_LAST = SWAP_REOPEN_BY_BID
      };
    /// <summary>
    /// Instant Execution Modes
    /// </summary>
    public enum EnInstantMode :uint
      {
      INSTANT_CHECK_NORMAL = 0,
      //--- begin and end instant
      INSTANT_CHECK_FIRST = INSTANT_CHECK_NORMAL,
      INSTANT_CHECK_LAST = INSTANT_CHECK_NORMAL
      };
    /// <summary>
    /// Request Execution Flags
    /// </summary>
    public enum EnRequestFlags :uint
      {
      REQUEST_FLAGS_NONE = 0,  // node
      REQUEST_FLAGS_ORDER = 1,  // trade orders should be additional confirmed after quotation
      //--- flags borders
      REQUEST_FLAGS_ALL = REQUEST_FLAGS_ORDER
      };
    /// <summary>
    /// Flags trade orders
    /// </summary>
    public enum EnTradeOrderFlags :uint
      {
      ORDER_FLAGS_NONE = 0, // all disabled
      ORDER_FLAGS_MARKET = 1, // ascees market orders 
      ORDER_FLAGS_LIMIT = 2, // ascees limit orders
      ORDER_FLAGS_STOP = 4, // ascees stop orders
      ORDER_FLAGS_STOP_LIMIT = 8, // ascees limit orderразрешены стоп-лимит ордера
      ORDER_FLAGS_SL = 16,// ascees limit orderразрешены стоп-лоссы
      ORDER_FLAGS_TP = 32,// разрешены тейк-профиты
      //--- all
      ORDER_FLAGS_FIRST = ORDER_FLAGS_MARKET,
      ORDER_FLAGS_ALL = ORDER_FLAGS_MARKET | ORDER_FLAGS_LIMIT | ORDER_FLAGS_STOP | ORDER_FLAGS_STOP_LIMIT | ORDER_FLAGS_SL | ORDER_FLAGS_TP
      };
    /// <summary>
    /// Margin Rate Types
    /// </summary>
    public enum EnMarginRateTypes :uint
      {
      MARGIN_RATE_BUY             = 0,
      MARGIN_RATE_SELL            = 1,
      MARGIN_RATE_BUY_LIMIT       = 2,
      MARGIN_RATE_SELL_LIMIT      = 3,
      MARGIN_RATE_BUY_STOP        = 4,
      MARGIN_RATE_SELL_STOP       = 5,
      MARGIN_RATE_BUY_STOP_LIMIT  = 6,
      MARGIN_RATE_SELL_STOP_LIMIT = 7,
      //--- enumeration borders
      MARGIN_RATE_FIRST = MARGIN_RATE_BUY,
      MARGIN_RATE_LAST = MARGIN_RATE_SELL_STOP_LIMIT
      };
    /// <summary>
    /// allowed order flags
    /// </summary>
    public enum EnOrderFlags :uint
      {
      ORDER_FLAGS_NONE       = 0,  // none
      ORDER_FLAGS_MARKET     = 1,  // market orders
      ORDER_FLAGS_LIMIT      = 2,  // limit orders
      ORDER_FLAGS_STOP       = 4,  // stop orders
      ORDER_FLAGS_STOP_LIMIT = 8,  // stop limit orders
      ORDER_FLAGS_SL         = 16, // sl orders
      ORDER_FLAGS_TP         = 32, // tp orders
      //--- all
      ORDER_FLAGS_FIRST = ORDER_FLAGS_MARKET,
      ORDER_FLAGS_ALL = ORDER_FLAGS_MARKET | ORDER_FLAGS_LIMIT | ORDER_FLAGS_STOP | ORDER_FLAGS_STOP_LIMIT | ORDER_FLAGS_SL | ORDER_FLAGS_TP
      };
    /// <summary>
    /// Options Mode
    /// </summary>
    public enum EnOptionMode :uint
      {
      OPTION_MODE_EUROPEAN_CALL = 0,
      OPTION_MODE_EUROPEAN_PUT  = 1,
      OPTION_MODE_AMERICAN_CALL = 2,
      OPTION_MODE_AMERICAN_PUT  = 3,
      //--- enumeration borders
      OPTION_MODE_FIRST = OPTION_MODE_EUROPEAN_CALL,
      OPTION_MODE_LAST = OPTION_MODE_AMERICAN_PUT
      };
    /// <summary>
    /// Splice Type
    /// </summary>
    public enum EnSpliceType
      {
       SPLICE_NONE       = 0,
       SPLICE_UNADJUSTED = 1,
       SPLICE_ADJUSTED   = 2,
       //--- enumeration borders
       SPLICE_FIRST      = SPLICE_NONE,
       SPLICE_LAST       = SPLICE_ADJUSTED
      };
    /// <summary>
    /// Splice Time Type
    /// </summary>
    public enum EnSpliceTimeType
      {
       SPLICE_TIME_EXPIRATION = 0,
       //--- enumeration borders
       SPLICE_TIME_FIRST      = SPLICE_TIME_EXPIRATION,
       SPLICE_TIME_LAST       = SPLICE_TIME_EXPIRATION
      };

    /// <summary>
    /// name
    /// </summary>
    public string Symbol { get; set; }
    /// <summary>
    /// hierarchical symbol path (including symbol name)
    /// </summary>
    public string Path { get; set; }
    /// <summary>
    /// ISIN
    /// </summary>
    public string ISIN { get; set; }
    /// <summary>
    /// local description
    /// </summary>
    public string Description { get; set; }
    /// <summary>
    /// internation description
    /// </summary>
    public string International { get; set; }
    /// <summary>
    /// basic symbol name
    /// </summary>
    public string Basis { get; set; }
    /// <summary>
    /// source symbol name
    /// </summary>
    public string Source { get; set; }
    /// <summary>
    /// symbol specification page URL
    /// </summary>
    public string Page { get; set; }
    /// <summary>
    /// symbol base currency
    /// </summary>
    public string CurrencyBase { get; set; }
    /// <summary>
    /// symbol profit currency
    /// </summary>
    public string CurrencyProfit { get; set; }
    /// <summary>
    /// symbol margin currency
    /// </summary>
    public string CurrencyMargin { get; set; }
    /// <summary>
    /// symbol color
    /// </summary>
    public string Color { get; set; }
    /// <summary>
    /// symbol background color
    /// </summary>
    public string ColorBackground { get; set; }
    /// <summary>
    /// symbol digits
    /// </summary>
    public uint Digits { get; set; }
    /// <summary>
    /// symbol digits derivation (1/10^digits & 10^digits)
    /// </summary>
    public double Point { get; set; }
    /// <summary>
    /// Multiply
    /// </summary>
    public double Multiply { get; set; }
    /// <summary>
    /// MTEnTickFlags
    /// </summary>
    public EnTickFlags TickFlags { get; set; }
    /// <summary>
    /// Depth of Market depth (both legs)
    /// </summary>
    public uint TickBookDepth { get; set; }
    /// <summary>
    /// filtration soft level
    /// </summary>
    public uint FilterSoft { get; set; }
    /// <summary>
    /// filtration soft level counter
    /// </summary>
    public uint FilterSoftTicks { get; set; }
    /// <summary>
    /// filtration hard level
    /// </summary>
    public uint FilterHard { get; set; }
    /// <summary>
    /// filtration hard level counter
    /// </summary>
    public uint FilterHardTicks { get; set; }
    /// <summary>
    /// filtration discard level
    /// </summary>
    public uint FilterDiscard { get; set; }
    /// <summary>
    /// spread max value
    /// </summary>
    public uint FilterSpreadMax { get; set; }
    /// <summary>
    /// spread min value
    /// </summary>
    public uint FilterSpreadMin { get; set; }
    /// <summary>
    /// EnTradeMode symbol trading mode for the group.
    /// </summary>
    public EnTradeMode TradeMode { get; set; }
    /// <summary>
    /// EnTradeFlags
    /// </summary>
    public EnTradeFlags TradeFlags { get; set; }
    /// <summary>
    /// EnCalcMode
    /// </summary>
    public EnCalcMode CalcMode { get; set; }
    /// <summary>
    /// EnCalcMode symbol execution mode for the group.
    /// </summary>
    public EnExecutionMode ExecMode { get; set; }
    /// <summary>
    /// EnGTCMode
    /// </summary>
    public EnGTCMode GTCMode { get; set; }
    /// <summary>
    /// EnFillingFlags
    /// </summary>
    public EnFillingFlags FillFlags { get; set; }
    /// <summary>
    /// EnOrderFlags
    /// </summary>
    public EnOrderFlags OrderFlags { get; set; }
    /// <summary>
    /// EnExpirationFlags
    /// </summary>
    public EnExpirationFlags ExpirFlags { get; set; }
    /// <summary>
    /// symbol spread (0-floating)
    /// </summary>
    public uint Spread { get; set; }
    /// <summary>
    /// spread balance
    /// </summary>
    public int SpreadBalance { get; set; }
    /// <summary>
    /// spread difference (0 - floating spread)
    /// </summary>
    public int SpreadDiff { get; set; }
    /// <summary>
    /// spread difference balance
    /// </summary>
    public int SpreadDiffBalance { get; set; }
    /// <summary>
    /// tick value
    /// </summary>
    public double TickValue { get; set; }
    /// <summary>
    /// tick size
    /// </summary>
    public double TickSize { get; set; }
    /// <summary>
    /// Contract size
    /// </summary>
    public double ContractSize { get; set; }
    /// <summary>
    /// stops level
    /// </summary>
    public int StopsLevel { get; set; }
    /// <summary>
    /// freeze level
    /// </summary>
    public int FreezeLevel { get; set; }
    /// <summary>
    /// quotes timeout
    /// </summary>
    public uint QuotesTimeout { get; set; }
    /// <summary>
    /// minimal volume
    /// </summary>
    public ulong VolumeMin { get; set; }
    /// <summary>
    /// maximal volume
    /// </summary>
    public ulong VolumeMax { get; set; }
    /// <summary>
    /// volume step
    /// </summary>
    public ulong VolumeStep { get; set; }
    /// <summary>
    /// cumulative positions and orders limit
    /// </summary>
    public ulong VolumeLimit { get; set; }
    /// <summary>
    /// EnMarginCheck
    /// 
    /// Deprecated
    /// </summary>
    public EnMarginFlags MarginCheckMode { get; set; }
    /// <summary>
    /// EnMarginCheck
    /// </summary>
    public EnMarginFlags MarginFlags { get; set; }
    /// <summary>
    /// initial margin
    /// </summary>
    public double MarginInitial { get; set; }
    /// <summary>
    /// maintenance margin
    /// </summary>
    public double MarginMaintenance { get; set; }
    /// <summary>
    /// orders and positions margin rates
    /// </summary>
    public Dictionary<EnMarginRateTypes,double> MarginRateInitial { get; set; }
    /// <summary>
    /// orders and positions margin rates
    /// </summary>
    public Dictionary<EnMarginRateTypes,double> MarginRateMaintenance { get; set; }
    /// <summary>
    /// orders and positions margin rates
    /// </summary>
    public double MarginRateLiquidity { get; set; }
    /// <summary>
    /// hedged margin rates
    /// </summary>
    public double MarginHedged { get; set; }
    /// <summary>
    /// long orders and positions margin rate
    /// </summary>
    [Obsolete("Use MarginRateInitial", false)]
    public double MarginLong { get; set; }
    /// <summary>
    /// short orders and positions margin rate
    /// </summary>
    [Obsolete("Use MarginRateInitial", false)]
    public double MarginShort { get; set; }
    /// <summary>
    /// limit orders and positions margin rate
    /// </summary>
    [Obsolete("Use MarginRateInitial", false)]
    public double MarginLimit { get; set; }
    /// <summary>
    /// stop orders and positions margin rate
    /// </summary>
    [Obsolete("Use MarginRateInitial", false)]
    public double MarginStop { get; set; }
    /// <summary>
    /// stop-limit orders and positions margin rate
    /// </summary>
    [Obsolete("Use MarginRateInitial", false)]
    public double MarginStopLimit { get; set; }
    /// <summary>
    /// EnSwapMode
    /// </summary>
    public EnSwapMode SwapMode { get; set; }
    /// <summary>
    /// long positions swaps rate
    /// </summary>
    public double SwapLong { get; set; }
    /// <summary>
    /// short positions swaps rate
    /// </summary>
    public double SwapShort { get; set; }
    /// <summary>
    /// 3 time swaps day
    /// </summary>
    public uint Swap3Day { get; set; }
    /// <summary>
    /// trade start date
    /// </summary>
    public ulong TimeStart { get; set; }
    /// <summary>
    /// trade end date
    /// </summary>
    public ulong TimeExpiration { get; set; }
    /// <summary>
    /// quote sessions
    /// </summary>
    public List<List<MTConSymbolSession>> SessionsQuotes { get; set; }
    /// <summary>
    /// trade sessions
    /// </summary>
    public List<List<MTConSymbolSession>> SessionsTrades { get; set; }
    /// <summary>
    /// request execution flags
    /// </summary>
    public EnRequestFlags REFlags { get; set; }
    /// <summary>
    /// instant execution
    /// </summary>
    public uint RETimeout { get; set; }
    /// <summary>
    /// instant execution check mode
    /// </summary>
    public EnInstantMode IECheckMode { get; set; }
    /// <summary>
    /// instant execution timeout
    /// </summary>
    public uint IETimeout { get; set; }
    /// <summary>
    /// instant execution profit slippage
    /// </summary>
    public uint IESlipProfit { get; set; }
    /// <summary>
    /// instant execution losing slippage
    /// </summary>
    public uint IESlipLosing { get; set; }
    /// <summary>
    ///  instant execution max volume
    /// </summary>
    public ulong IEVolumeMax { get; set; }
    /// <summary>
    /// settle price (for futures)
    /// </summary>
    public double PriceSettle { get; set; }
    /// <summary>
    /// price limit max (for futures)
    /// </summary>
    public double PriceLimitMax { get; set; }
    /// <summary>
    /// price limit min (for futures)
    /// </summary>
    public double PriceLimitMin { get; set; }
    /// <summary>
    /// option strike price value
    /// </summary>
    public double PriceStrike { get; set; }
    /// <summary>
    /// options mode EnOptionMode
    /// </summary>
    public EnOptionMode OptionsMode { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public double FaceValue { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public double AccruedInterest { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public EnSpliceType SpliceType { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public EnSpliceTimeType SpliceTimeType { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public uint SpliceTimeDays { get; set; }
    /// <summary>
    /// Create MTConSymbol with default values
    /// </summary>
    /// <returns></returns>
    public static MTConSymbol CreateDefault()
      {
      MTConSymbol symbol = new MTConSymbol();
      //---
      symbol.CurrencyBase = "USD";
      symbol.CurrencyProfit = "USD";
      symbol.CurrencyMargin = "USD";
      symbol.Digits = 4;
      symbol.TickFlags = EnTickFlags.TICK_REALTIME;
      symbol.TickBookDepth = 0;
      symbol.FilterSoft = 100;
      symbol.FilterSoftTicks = 10;
      symbol.FilterDiscard = 500;
      symbol.FilterHard = 500;
      symbol.FilterHardTicks = 10;
      symbol.FilterSpreadMax = 0;
      symbol.FilterSpreadMin = 0;
      symbol.TradeMode = EnTradeMode.TRADE_FULL;
      symbol.TradeFlags = EnTradeFlags.TRADEFLAGS_NONE;
      symbol.CalcMode = EnCalcMode.TRADE_MODE_FOREX;
      symbol.ExecMode = EnExecutionMode.EXECUTION_INSTANT;
      symbol.GTCMode = EnGTCMode.ORDERS_GTC;
      symbol.FillFlags = EnFillingFlags.FILL_FLAGS_FOK;
      symbol.ExpirFlags = EnExpirationFlags.TIME_FLAGS_ALL;
      symbol.OrderFlags = EnOrderFlags.ORDER_FLAGS_NONE;
      symbol.Spread = 0;
      symbol.SpreadBalance = 0;
      symbol.SpreadDiff = 0;
      symbol.SpreadDiffBalance = 0;
      symbol.TickValue = 0;
      symbol.TickSize = 0;
      symbol.ContractSize = 100000;
      symbol.StopsLevel = 5;
      symbol.FreezeLevel = 0;
      symbol.QuotesTimeout = 0;
      symbol.VolumeMin = 0;
      symbol.VolumeMax = 100000;
      symbol.VolumeStep = 10000;
      symbol.VolumeLimit = 0;
      symbol.MarginFlags = symbol.MarginCheckMode = EnMarginFlags.MARGIN_FLAGS_NONE;
      symbol.MarginInitial = 0;
      symbol.MarginMaintenance = 0;
      //---
      symbol.MarginRateInitial = new Dictionary<EnMarginRateTypes,double>{
        {EnMarginRateTypes.MARGIN_RATE_BUY,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_STOP,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_STOP,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_STOP_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_STOP_LIMIT,0.0}
      };
      symbol.MarginRateMaintenance = new Dictionary<EnMarginRateTypes,double>{
        {EnMarginRateTypes.MARGIN_RATE_BUY,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_STOP,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_STOP,0.0},
        {EnMarginRateTypes.MARGIN_RATE_BUY_STOP_LIMIT,0.0},
        {EnMarginRateTypes.MARGIN_RATE_SELL_STOP_LIMIT,0.0}
      };
      symbol.MarginRateLiquidity = 0;
      symbol.MarginHedged       = 0;
#pragma warning disable CS0618 // “MTConSymbol.MarginLong”已过时:“Use MarginRateInitial”
      symbol.MarginLong = 1;
#pragma warning restore CS0618 // “MTConSymbol.MarginLong”已过时:“Use MarginRateInitial”
#pragma warning disable CS0618 // “MTConSymbol.MarginShort”已过时:“Use MarginRateInitial”
      symbol.MarginShort = 1;
#pragma warning restore CS0618 // “MTConSymbol.MarginShort”已过时:“Use MarginRateInitial”
#pragma warning disable CS0618 // “MTConSymbol.MarginLimit”已过时:“Use MarginRateInitial”
      symbol.MarginLimit = 0;
#pragma warning restore CS0618 // “MTConSymbol.MarginLimit”已过时:“Use MarginRateInitial”
#pragma warning disable CS0618 // “MTConSymbol.MarginStop”已过时:“Use MarginRateInitial”
      symbol.MarginStop = 0;
#pragma warning restore CS0618 // “MTConSymbol.MarginStop”已过时:“Use MarginRateInitial”
#pragma warning disable CS0618 // “MTConSymbol.MarginStopLimit”已过时:“Use MarginRateInitial”
      symbol.MarginStopLimit = 0;
#pragma warning restore CS0618 // “MTConSymbol.MarginStopLimit”已过时:“Use MarginRateInitial”
      symbol.SwapMode = EnSwapMode.SWAP_DISABLED;
      symbol.SwapLong = 0;
      symbol.SwapShort = 0;
      symbol.Swap3Day = 3;
      symbol.TimeStart = 0;
      symbol.TimeExpiration = 0;
      symbol.REFlags = EnRequestFlags.REQUEST_FLAGS_NONE;
      symbol.RETimeout = 7;
      symbol.IECheckMode = EnInstantMode.INSTANT_CHECK_NORMAL;
      symbol.IETimeout = 7;
      symbol.IESlipProfit = 2;
      symbol.IESlipLosing = 2;
      symbol.IEVolumeMax = 0;
      symbol.PriceSettle = 0;
      symbol.PriceLimitMax = 0;
      symbol.PriceLimitMin = 0;
      symbol.PriceStrike = 0;
      symbol.OptionsMode = EnOptionMode.OPTION_MODE_EUROPEAN_CALL;
      symbol.FaceValue = 0;
      symbol.AccruedInterest = 0;
      symbol.SpliceType = EnSpliceType.SPLICE_NONE;
      symbol.SpliceTimeType = EnSpliceTimeType.SPLICE_TIME_EXPIRATION;
      symbol.SpliceTimeDays = 0;
      //---
      return symbol;
      }
    }
  }
